package BC110_井字棋;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String[][] arr = new String[3][3];

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                arr[i][j] = sc.next();
            }
        }

        int count = 0;

        String judge = judge(arr);
        System.out.println(judgePrint(judge));
    }

    private static String judgePrint(String judge) {
        String result = null;
        switch (judge){
            case "K":
                result = "KiKi wins!";
                break;
            case "O":
                result = "No winner!";
                break;
            case "B":
                result = "BoBo wins!";
                break;
            default:
                break;
        }
        return result;
    }

    private static String judge(String[][] arr) {
        for (int i = 0; i < 3; i++){
            if (arr[i][0].equals(arr[i][2]) && arr[i][0].equals(arr[i][2])){
                return arr[i][1];
            }else if (arr[1][i].equals(arr[2][i]) && arr[0][i].equals(arr[1][i])){
                return arr[1][i];
            }
        }

        if (arr[0][0].equals(arr[1][1]) && arr[1][1].equals(arr[2][2])){
            return arr[1][1];
        }else if (arr[0][2].equals(arr[1][1]) && arr[1][1].equals(arr[2][0])){
            return arr[1][1];
        }
        return null;
    }
}
